<!DOCTYPE html>
<html lang="en"
      xmlns:th="http://www.thymeleaf.org">
<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="管理页面">

    <title>设置页面</title>

    <!-- Bootstrap Core CSS -->
    <link th:href="@{/vendor/bootstrap/css/bootstrap.min.css}" href="/static/vendor/bootstrap/css/bootstrap.min.css"
          rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link href="/vendor/metisMenu/metisMenu.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="/dist/css/sb-admin-2.min.css" rel="stylesheet">

    <!-- bootstrap-table -->
    <link th:href="@{/vendor/bootstrap-table/bootstrap-table.min.css}"
          href="/static/vendor/bootstrap-table/bootstrap-table.css" rel="stylesheet" type="text/css">

    <link th:href="@{/vendor/bootstrap3-editable/css/bootstrap-editable.css}"
          href="/static/vendor/bootstrap3-editable/css/bootstrap-editable.css" rel="stylesheet" type="text/css">


    <!-- Custom Fonts -->
    <link href="/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">


</head>

<body>

<div id="wrapper">

    <!-- Navigation -->
    <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/admin/index">软件介绍</a>
        </div>
        <!-- /.navbar-header -->


        <!--<ul th:include="headMacro::index_top" class="nav navbar-top-links navbar-right"></ul>-->

        <!-- /.navbar-top-links -->

        <div th:include="headMacro::index_side" class="navbar-default sidebar" role="navigation"></div>
    </nav>

    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">软件介绍</h1>
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->

        <div class="row">

            <div class="col-lg-6">
                <div class="panel panel-default">
                    <div class="panel-body form-horizontal">


                            <div class="form-group">
                                <label for="title" class="col-lg-2 control-label">标题：</label>
                                <div class="col-lg-10">
                                    <input id="title" th:value="${appDesc.title}" class="form-control input-lg"
                                           placeholder="请输入标题"/>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="content" class="col-lg-2 control-label">说明：</label>
                                <div class="col-lg-10">
                                    <input id="content" th:value="${appDesc.content}" class="form-control input-lg"
                                           placeholder="请输入说明"/>
                                </div>
                            </div>
                            <div class="form-group">
                                <label  class="col-lg-2 control-label">二维码图片：</label>
                                <div class="col-xs-6 col-md-3">
                                    <a href="javascript:;" class="thumbnail">
                                        <img th:src="@{${appDesc.qrImage}}" src="" alt="">
                                    </a>
                                </div>
                                <div class="input-group">
                                    <input type="file" id="qrcode" class="btn btn-default" value="上传">
                                </div>
                            </div>

                            <div class="form-group">
                                <label  class="col-lg-2 control-label">手机内图片：</label>

                                <div class="col-xs-6 col-md-3">
                                    <a href="javascript:;" class="thumbnail">
                                        <img th:src="@{${appDesc.mobileImage}}" src="" alt="">
                                    </a>
                                </div>
                                <div class="input-group">
                                    <input type="file" id="mobileFile" class="btn btn-default" value="上传">
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="input-group">
                                    <input id="saveAppDesc" type="button" class="col-lg-offset-1 btn btn-primary"
                                           value="保存软件介绍">
                                </div>
                            </div>

                    </div>
                    <!-- /.row (nested) -->
                    <!-- /.panel-body -->
                </div>
                <!-- /.panel -->
            </div>
        </div>

    </div>
    <!-- /#page-wrapper -->

</div>
<!-- /#wrapper -->

<!-- jQuery -->
<script th:src="@{/vendor/jquery/jquery.min.js}" src="/static/vendor/jquery/jquery.min.js"></script>

<!-- Bootstrap Core JavaScript -->
<script th:src="@{/vendor/bootstrap/js/bootstrap.min.js}" src="/static/vendor/bootstrap/js/bootstrap.min.js"></script>

<!-- Metis Menu Plugin JavaScript -->
<script src="/vendor/metisMenu/metisMenu.min.js"></script>
<script src="/dist/js/sb-admin-2.min.js"></script>

<!-- Custom Theme JavaScript -->
<script th:src="@{/js/admin.js}" src="/static/js/admin.js"></script>
<script>
    $("#saveAppDesc").on("click", function (event) {

        var formFile = new FormData();
        var qrFile = document.getElementById("qrcode").files[0]; // js 获取文件对象
        if (typeof (qrFile) !== "undefined" && qrFile.size > 0) {
            // formFile.append("action", "UploadVMKImagePath");
            formFile.append("qrFile", qrFile);

        }
        var mobileFile = document.getElementById("mobileFile").files[0]; // js 获取文件对象
        if (typeof (mobileFile) !== "undefined" && mobileFile.size > 0) {
            // formFile.append("action", "UploadVMKImagePath");
            formFile.append("mobileFile", mobileFile);

        }
        var title = $("#title").val();
        var content = $("#content").val();
        formFile.append("title",title);
        formFile.append("content",content);


        $.ajax({
            url: '/company/saveAppDesc',
            type:'POST',
            data:formFile,
            processData: false,//用于对data参数进行序列化处理 这里必须false
            contentType: false, //必须
            success: function (datas) {
                alert("保存成功");
            }
        })
    })
</script>
</body>

</html>
